//
//  HXPViewController.m
//  tianyue
//
//  Created by ZhengYing on 2017/7/8.
//  Copyright © 2017年 zy. All rights reserved.
//

#import "HXPViewController.h"
#import "ZYSendBoxButton.h"
#import "ZYKrpanoButton.h"
#import "DDRotateViewController.h"
@interface HXPViewController ()
{NSString *path;
}
@property (unsafe_unretained, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIButton *zctBtin;

@property (weak, nonatomic) IBOutlet ZYSendBoxButton *rotatebtn;
@property (weak, nonatomic) IBOutlet ZYKrpanoButton *panoBtn;

@end

@implementation HXPViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.panoBtn.path = @"skin/zzp/101/101-360/vtour/tour.html";
    self.rotatebtn.path = @"skin/zzp/101/101-my";
    self.rotatebtn.maxCount=350;
    path =@"skin/zzp/101/101-zct";
    self.scrollView.contentSize = CGSizeMake(1024*4, 0);
    self.scrollView.delegate =self;
    for (int i=0; i<4; i++) {
        UIImageView *imagev = [[UIImageView alloc]initWithFrame:CGRectMake(1024*i, 0, 1024, 768)];
        [imagev setImage:[UIImage imageNamed:[NSString stringWithFormat:@"lct_%d",i+1]]];
        [self.scrollView addSubview:imagev];
    }
    // Do any additional setup after loading the view.
}

- (void) scrollViewDidScroll:(UIScrollView *)sender {
    // 得到每页宽度
    CGFloat pageWidth = sender.frame.size.width;
    // 根据当前的x坐标和页宽度计算出当前页数
    int currentPage = floor((sender.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
    switch (currentPage) {
        case 0:
        {
            self.panoBtn.path = @"skin/zzp/101/101-360/vtour/tour.html";
            self.rotatebtn.path = @"skin/zzp/101/101-my";
            self.rotatebtn.maxCount=350;
            path =@"skin/zzp/101/101-zct";

        }
            break;
        case 1:
        {
            self.panoBtn.path = @"skin/zzp/102/102-360/vtour/tour.html";
            self.rotatebtn.path = @"skin/zzp/102/102-my";
            path =@"skin/zzp/102/102-zct";

            self.rotatebtn.maxCount=500;

        }
            break;
        case 2:
        {
            self.panoBtn.path = @"skin/zzp/304/304-360/vtour/tour.html";
            self.rotatebtn.path = @"skin/zzp/304/304-my";
            path =@"skin/zzp/304/304-zct";

            self.rotatebtn.maxCount=350;


        }
            break;
        case 3:
        {
            self.panoBtn.path = @"skin/zzp/502/502-360/vtour/tour.html";
            self.rotatebtn.path = @"skin/zzp/502/502-my";
            path =@"skin/zzp/502/502-zct";

            self.rotatebtn.maxCount=300;


        }
            break;
        default:
            break;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.destinationViewController isKindOfClass:[DDRotateViewController class]]) {
        ((DDRotateViewController *)segue.destinationViewController).path = path;
    }
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}


@end
